﻿namespace TfsReportRenderer
{
    using System;
    using System.IO;

    public class TestResultData
    {
        public string TeamProject { get; set; }
        
        public string TestPlan { get; set; }
        
        public int Id { get; set; }
        
        public string TestSuiteName { get; set; }

        public string TestCaseName { get; set; }
        
        public string TestCaseStepName { get; set; }
        
        public string TestCaseStepOutcome { get; set; }
        
        public string TestCaseStepOutcomeComment { get; set; }
        
        public int TestIterationId { get; set; }
        
        public DateTime TestIterationDate { get; set; }
        
        public string TestCaseOutcome { get; set; }

        public Stream Image { get; set; }

        public string ImageBase64
        {
            get
            {
                if (this.Image == null)
                {
                    return string.Empty;
                }

                using (var memoryStream = new MemoryStream())
                {
                    this.Image.CopyTo(memoryStream);
                    return Convert.ToBase64String(memoryStream.ToArray());
                }
            }
        }

        public string TestUser { get; set; }
    }
}
